home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / e_to_l / edsspell / spellint.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  2.1 KB  |  73 lines

  1. (* SPELLINT.PAS - Copyright (c) 1995-1996, Eminent Domain Software *)
  2.  
  3. unit SpellInt;
  4.  {-interface unit for SPELLER.DLL}
  5.  {version 2.0 no longer uses the DLL}
  6.  {This file is provided for backward compatibility for users who}
  7.  {accessed the DLL directly}
  8.  
  9. {$I SPELLDEF.PAS}
  10.  
  11. interface
  12. uses
  13.   SysUtils, Classes, LexDCT;
  14.  
  15. function dllOpenDictionary(FileName : string) : Boolean;
  16.   {-Opens the specified dictionary; Returns TRUE if successful}
  17. function dllInDictionary(AWord: String) : Boolean;
  18.   {-Returns TRUE if AWord is in the dictionary}
  19. function dllAddWord(AWord : String) : Boolean;
  20.   {-Adds AWord to User Dictionary; Returns TRUE if successful}
  21. function  dllSuggestWords(AWord: String; NumSuggest: byte): TStringList;
  22.   {-Suggests words; Returns nil if unsuccessful}
  23. procedure dllDeleteUserWords;
  24.   {-Deletes all word in User Dictionary}
  25. procedure dllCloseDictionary;
  26.   {-Closes the currently open dictionary}
  27.  
  28. implementation
  29.  
  30. function dllOpenDictionary(FileName : string) : Boolean;
  31.   {-Opens the specified dictionary; Returns TRUE if successful}
  32. begin
  33.   if DCT = nil then
  34.     DCT := TDictionary.Create;
  35.   Result := DCT.OpenDictionary (Filename, 'USERDCT.TXT');
  36. end;  { dllOpenDictionary }
  37.  
  38. function dllInDictionary(AWord: String) : Boolean;
  39.   {-Returns TRUE if AWord is in the dictionary}
  40. begin
  41.   Result := DCT.InDictionary (AWord);
  42. end;  { dllInDictionary }
  43.  
  44. function dllAddWord(AWord : String) : Boolean;
  45.   {-Adds AWord to User Dictionary; Returns TRUE if successful}
  46. begin
  47.   Result := DCT.AddWord (AWord);
  48. end;  { dllAddWord }
  49.  
  50. function dllSuggestWords(AWord: String; NumSuggest: byte): TStringList;
  51.   {-Suggests words; Returns nil if unsuccessful}
  52. begin
  53.   Result := DCT.SuggestWords (AWord, NumSuggest);
  54. end;  { dllSuggestWords }
  55.  
  56. procedure dllDeleteUserWords;
  57.   {-Deletes all word in User Dictionary}
  58. var
  59.   F: File;
  60. begin
  61.   DCT.AddedWords.Clear;
  62.   Assign (F, ExtractFilePath (DCT.DictFile) + DCT.UserDict);
  63.   Erase (F);
  64. end;  { dllDeleteUserWords }
  65.  
  66. procedure dllCloseDictionary;
  67.   {-Closes the currently open dictionary}
  68. begin
  69.   DCT.Destroy;
  70. end;  { dllCloseDictionary }
  71.  
  72. end.  { SpellInt }
  73.